package fr.vvins.core.search.query;

import java.util.ArrayList;
import java.util.List;

import fr.vvins.core.dao.Entity;

/**
 * Bean container for search results.
 * @author fguay
 *
 */
public class SearchResult {
    
    private long elapsedTime;
    private int qTime;
    private int status;
    private List<Entity> results;
    private long start;
    private long found;
    
    public void addResult(Entity pItem){
        if(results == null) {
            results = new ArrayList<Entity>();
        }
        results.add(pItem);
    }


    public long getElapsedTime() {
        return elapsedTime;
    }

    public void setElapsedTime(long pElapsedTime) {
        elapsedTime = pElapsedTime;
    }

    public int getqTime() {
        return qTime;
    }

    public void setqTime(int pQTime) {
        qTime = pQTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int pStatus) {
        status = pStatus;
    }


    public List<Entity> getResults() {
        return results;
    }


    public void setResults(List<Entity> pResults) {
        results = pResults;
    }


    public long getSize() {
        return (results != null)? results.size():0;
    }


    public long getFound() {
        return found;
    }


    public void setFound(long pFound) {
        found = pFound;
    }


    public long getStart() {
        return start;
    }


    public void setStart(long pStart) {
        start = pStart;
    }
    

	@Override
	public String toString() {
		return "SearchResult [elapsedTime=" + elapsedTime + ", qTime=" + qTime
				+ ", status=" + status + ", results=" + results + ", start="
				+ start + ", found=" + found + "]";
	}

}
